home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / maxsbbsus.lha / MAX154 / TBM / Scripts / bkup.rex < prev    next >
OS/2 REXX Batch file  |  1995-04-25  |  3KB  |  77 lines

  1.   This ARexx file takes a list of files in a directory and makes a script-
  2. file for Executing, with a command interjected in front of every name on the
  3. list, and a destination, or whatever, tagged on afterward.  It can also add a
  4. line in between each entry, like a FailAt command.
  5.  
  6.   Let's say you're a SysOp and you've got 1,000 precious MOD files.  You put
  7. a CD online and it's got 3,000 MOD files on it.  You figure probably half of
  8. yours are duplicates, so you'd just as soon delete them, to get the hard
  9. drive space back.  But actually you'd rather just move them to a different
  10. directory, so you can check them out before giving them the ax. 
  11.  
  12.   The first thing you do is make a text output of the MOD files on the CD,
  13. like "List >filename CD0:MODS short".  Then pop it into your favorite text
  14. editor and clean things up, leaving just the file names.  
  15.  
  16.   Make sure you've run RexxMast (System dir) to get ARexx going in the
  17. background, and your rexxc directory should be in the paths.  
  18.  
  19.   Usage is: rx bkup.rex <filename> 
  20.  
  21.   That will take the list of names and do the following to it:
  22.  
  23.   
  24. -- clip here --
  25.  
  26.  
  27. /* Asher's working super-duper thingamajig - Version 1.1 */
  28. parse arg file
  29. command1 = 'Rename DH0:Mods/'  /*  goes before each name  */
  30. command2 = 'DH0:Mods2/'        /*  goes after             */
  31. command3 = 'FailAt 25'         /*  interjected between each line  */
  32. thefile = file
  33. outf2 = 'ram:out'            /*  the scriptfile it makes to be Executed  */
  34. outf1 = outf2
  35. open(thefile,file, 'r')
  36. open(outf1, outf2, 'w')
  37. signal loop
  38. Loop:
  39. do while ~eof(thefile)
  40.  xx = readln(thefile)
  41.  xx = command1 xx command2
  42.  writeln(outf1, command3)   /*  remove this line to take out extra command  */
  43.  writeln(outf1, xx)        
  44.  end
  45.   close(thefile)
  46.   say 'Done!'
  47.   exit
  48.  else do
  49.   signal loop 
  50.  
  51.  
  52. --  clip here  --
  53.  
  54.  
  55.   Your scriptfile, which you'll Execute, now says:
  56.  
  57. FailAt 25
  58. Rename DH0:Mods/ABCMOD.LHA DH0:Mods2/
  59. FailAt 25
  60. Rename DH0:Mods/DEFMOD.LHA DH0:Mods2/
  61. FailAt 25
  62. Rename DH0:Mods/GHIMOD.LHA DH0:Mods2/
  63. FailAt 25
  64. Rename DH0:Mods/JKLMOD.LHA DH0:Mods2/
  65. <etc>
  66.  
  67.   Then you Execute the scriptfile, and it tries to rename all the files that
  68. have the same names as the CD files to a different directory.  If it doesn't
  69. find the file, the FailAt command keeps the scriptfile going. 
  70.  
  71.   There are spaces placed by the rexxfile here and there, usually it doesn't
  72. matter.  If it does, use a smart text editor and get rid of them, like with a
  73. column delete, or a Search & Replace.  CygnusEd is the best.
  74.  
  75.   Have fun!
  76.  
  77.